using Bingo.API.Resources;
using CatLib;
using UnityEngine;

namespace Bingo.Facades
{
    /// <summary>
    /// 资源服务门面
    /// </summary>
    public class Resources : Facade<IResources>
    {
        /// <summary>
        /// 同步加载AssetBundle里的资源
        /// </summary>
        /// <param name="ownBundle">assetBundle名字</param>
        /// <param name="assetName">资源名字</param>
        /// <typeparam name="T">加载的数据类型</typeparam>
        /// <returns></returns>
        public static T LoadSync<T>(string ownBundle, string assetName) where T : Object
        {
            return Instance.LoadSync<T>(ownBundle, assetName);
        }

        /// <summary>
        /// 只通过资源名字进行同步加载 
        /// </summary>
        /// <param name="assetName">资源名字</param>
        /// <typeparam name="T">加载的数据类型</typeparam>
        /// <returns></returns>
        public static T LoadSync<T>(string assetName) where T : Object
        {
            return Instance.LoadSync<T>(assetName);
        }
        
        /// <summary>
        /// 只通过资源名字进行同步加载
        /// </summary>
        /// <param name="name">资源名字</param>
        /// <returns></returns>
        public static Object LoadSync(string name)
        {
            return Instance.LoadSync(name);
        }
    }
}
